<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">
<f:view locale="#{salaoMB.internacionalizacao.currentLocale}">
	<h:head>
		<title>Novo Estabelecimento</title>

	</h:head>
	<h:body>
		<table width="100%">
			<tr>
				<td><ui:include src="/index.xhtml" /></td>
			</tr>
		</table>
		<h:form id="incluirEstabelecimento" style="width:100%"	prependId="false">
			<table align="center">
				<tr>
					<td style="font-size: 15px;font-family: Arial; font-weight: bold;">Etapa 1 de 5</td>
					<td>&nbsp;</td>
				</tr>
			</table>
			<table width="40%" align="center">
				<tr>
					<td>
						<p:growl id="growl" showDetail="true" sticky="true" />
						<p:panel header="Cadastro de Estabelecimento">
							<h:panelGrid columns="2" cellpadding="5" width="40%" style="width:100%" border="0">

								<h:outputText id="textRazaoSocial" value="Raz&atilde;o Social: " />					
								<p:inputText id="razaoSocial"
									value="#{estabelecimentoMB.estabelecimento.razaoSocial}"
									maxlength="30" size="30" required="true"
									requiredMessage="#{msg.CampoObrigatorio}" />
								
								<h:outputText id="textNomeFantasia" value="Nome fantasia: " />	
								<p:inputText id="nomeFantasia"
									value="#{estabelecimentoMB.estabelecimento.nomeFantasia}"
									maxlength="30" size="30" required="true"
									requiredMessage="#{msg.CampoObrigatorio}" />
									
								<h:outputText id="textCnpj"
									value="Inscri&ccedil;&atilde;o (CNPJ): " />
								<p:inputMask id="cnpj"
									value="#{estabelecimentoMB.estabelecimento.cnpj}"
									maxlength="20" mask="99.999.999/9999-99" size="30"
									required="true" requiredMessage="#{msg.CampoObrigatorio}" />
									
								<h:outputText id="textPais" value="Pa&iacute;s: " />
						        <h:selectOneMenu value="#{estabelecimentoMB.idComboPais}" rendered="true" id="estabelecimento_pais" immediate="true" >
						          <f:selectItem itemLabel="Selecione..." itemValue="0"/>					
							      <f:selectItems value="#{estabelecimentoMB.mapPaises}" />
							      <p:ajax update="estabelecimento_comboEstado" listener="#{agendamentoMB.localizarEstadoByIdPais}" />							   		
							    </h:selectOneMenu> 									

								<h:outputText id="textEstado" value="Estado: " />								
								<h:selectOneMenu value="#{estabelecimentoMB.idSelectedEstado}" rendered="true" immediate="true" id="estabelecimento_comboEstado" >				
							      <f:selectItem itemLabel="Selecione..." itemValue="0"/>	
							      <f:selectItems value="#{estabelecimentoMB.mapEstados}" />
							     </h:selectOneMenu>									

								<h:outputText id="textCidade" value="Cidade: " />
								<p:inputText id="cidade"
									value="#{estabelecimentoMB.selectedCidade}"
									maxlength="20" size="30" required="true"
									requiredMessage="#{msg.CampoObrigatorio}" />

								<h:outputText id="textBairro" value="Bairro: " />
								<p:inputText id="bairro"
									value="#{estabelecimentoMB.selectedBairro}"
									maxlength="20" size="30" required="true"
									requiredMessage="#{msg.CampoObrigatorio}" />
									
								<h:outputText id="textLogradouro" value="Logradouro: " />
								<p:inputText id="logradouro"
									value="#{estabelecimentoMB.estabelecimento.endereco.logradouro}"
									maxlength="60" size="30" required="true"
									requiredMessage="#{msg.CampoObrigatorio}" />	

								<h:outputText id="textNumero" value="Número: " />
								<p:inputText id="numero"
									value="#{estabelecimentoMB.estabelecimento.endereco.numero}"
									maxlength="5" size="10" required="true"
									requiredMessage="#{msg.CampoObrigatorio}" />
									
								<h:outputText id="textCep" value="CEP: " />
								<p:inputText id="cep"
									value="#{estabelecimentoMB.estabelecimento.endereco.cep}"
									maxlength="20" size="20" required="true"
									requiredMessage="#{msg.CampoObrigatorio}" />	
									
								<h:outputText id="textTelefone" value="Telefone: " />
								<h:panelGroup>
									<p:inputText id="ddd" value="#{estabelecimentoMB.estabelecimento.ddd}" size="3" maxlength="2" /> &nbsp;
									<p:inputText id="telefone" value="#{estabelecimentoMB.estabelecimento.telefone}" maxlength="8" />
								</h:panelGroup>									
																		
								<h:inputHidden />
								<h:commandButton type="submit" id="btnEstabelecimentoSalvar"
									action="#{estabelecimentoMB.incluir}" value="#{msg.confirmar}"
									icon="ui-icon-disk" update="growl,incluirEstabelecimento" global="true">
										<f:param  name="idEstabelecimento" value="#{newEstabelecimento.id}" />
								</h:commandButton>	
							</h:panelGrid>
						</p:panel></td>
				</tr>
			</table>
		</h:form>
	</h:body>
</f:view>
</html>